package com.ruoyi.common.core.domain.entity;

import java.util.Date;
import java.util.List;
import javax.validation.constraints.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;

/**
 * 用户对象 sys_user
 *
 * @author ruoyi
 */
public class SysUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
//    @Excel(name = "序号", cellType = ColumnType.NUMERIC, prompt = "用户编号",sort = 1)
    private Long userId;

    /** 用户ID */
    @Excel(name = "序号",cellType = ColumnType.NUMERIC, isSeq = true,sort = 1)
    private Long seq;

    /** 部门ID */
    private Long deptId;

    /** 用户账号 */
    private String userName;

    /** 用户昵称 */
    @Excel(name = "姓名",sort = 3)
    private String nickName;

    /** 用户邮箱 */
    private String email;

    /** 手机号码 */
    @Excel(name = "联系方式",sort=10)
    private String phonenumber;

    /** 用户性别 */
    @Excel(name = "性别", readConverterExp = "0=男,1=女,2=未知",sort=4)
    private String sex;

    /** 用户头像 */
    private String avatar;

    /** 密码 */
    private String password;

    /** 岗位状态（0在岗 1不在岗 2退休） */
    @Excel(name = "岗位状态（在岗、不在岗、退休）",readConverterExp = "0=在岗,1=不在岗,2=退休",sort=23)
    private String status;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    /** 最后登录IP */
    private String loginIp;

    /** 最后登录时间 */
    private Date loginDate;

    /** 部门对象 */
    @Excel(name = "所在党支部", targetAttr = "deptName",sort =2)
    private String deptName;

    private SysDept dept;

    /** 角色对象 */
    private List<SysRole> roles;

    /** 角色组 */
    private Long[] roleIds;

    /** 岗位组 */
    private Long[] postIds;

    /** 角色ID */
    private Long roleId;

    /** 籍贯 */
    @Excel(name = "籍贯",sort=6)
    private String nativePlace;


    /** 家庭地址 */
    @Excel(name = "家庭地址",sort=7)
    private String homeAdress;

    /** 身份证号 */
    @Excel(name = "身份证号",sort=8)
    private String idCard;


    /** 出生日期 */
    @Excel(name = "出生日期",sort=9)
    private String birthday;

    /** 最高学历 */
    @Excel(name = "最高学历",sort=11)
    private String highestEducation;

    /** 毕业院校 */
    @Excel(name = "毕业院校",sort=12)
    private String graduateSchool;

    /** 所学专业 */
    @Excel(name = "所学专业",sort=13)
    private String major;

    /** 专业技术资格名称 */
    @Excel(name = "专业技术资格名称",sort=14)
    private String majorName;

    /** 党内职务 */
    @Excel(name = "党内职务",sort=15)
    private String postName;

    /** 行政职务（数据字典） */
    @Excel(name = "行政职务（精确到具体项目部名称）",dictType = "organization_administrative_post",sort=16)
    private String administrativePost;

    /** 参加工作时间 */
    @Excel(name = "参加工作时间",sort=17)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private String workTime;

    /** 进入本单位时间 */
    @Excel(name = "进入本单位时间",sort=18)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private String enterUnitTime;

    /** 用工方式（数据字典） */
    @Excel(name = "用工方式（自有、劳务派遣）",dictType = "organization_employment_mode",sort=19)
    private String employmentMode;

    /** 确定为预备党员时间 */
    @Excel(name = "确定为预备党员时间",sort=20)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private String readyPartyTime;

    /** 预备党员转正时间 */
    @Excel(name = "预备党员转正时间",sort=21)
    private String partyTime;

    /** 组织关系转入时间 */
    @Excel(name = "组织关系转入时间",sort=22)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private String organizationRelationTime;

    /** 党员类别（数据字典） */
    @Excel(name = "党员类别（正式、流动、预备）",dictType = "organization_party_type",sort=24)
    private String partyType;

    /** 流动党员所在党支部名称 */
    private Long flowPartyMemberDept;

    /** 流动党员所在党支部名称 */
    @Excel(name = "流动党员所在党支部名称",sort=25)
    private String flowPartyMemberDeptName;

    /** 档案所在地 */
    @Excel(name = "档案所在地（四局、公司、分公司、人才交流市场、社区等）（精确到具体的社区、乡镇、人才市场名称）",sort=26)
    private String recordLocation;

    /** 民族 */
    @Excel(name = "民族",sort=5)
    private String nation;

    public SysUser()
    {

    }

    public SysUser(Long userId)
    {
        this.userId = userId;
    }

    public Long getUserId()
    {
        return userId;
    }

    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

    public boolean isAdmin()
    {
        return isAdmin(this.userId);
    }

    public static boolean isAdmin(Long userId)
    {
        return userId != null && 1L == userId;
    }

    public Long getDeptId()
    {
        return deptId;
    }

    public void setDeptId(Long deptId)
    {
        this.deptId = deptId;
    }

    @Xss(message = "用户昵称不能包含脚本字符")
    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
    public String getNickName()
    {
        return nickName;
    }

    public void setNickName(String nickName)
    {
        this.nickName = nickName;
    }

    @Xss(message = "用户账号不能包含脚本字符")
    @NotBlank(message = "用户账号不能为空")
    @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
    public String getUserName()
    {
        return userName;
    }

    public void setUserName(String userName)
    {
        this.userName = userName;
    }

    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    public String getPhonenumber()
    {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber)
    {
        this.phonenumber = phonenumber;
    }

    public String getSex()
    {
        return sex;
    }

    public void setSex(String sex)
    {
        this.sex = sex;
    }

    public String getAvatar()
    {
        return avatar;
    }

    public void setAvatar(String avatar)
    {
        this.avatar = avatar;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public String getDelFlag()
    {
        return delFlag;
    }

    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    public String getLoginIp()
    {
        return loginIp;
    }

    public void setLoginIp(String loginIp)
    {
        this.loginIp = loginIp;
    }

    public Date getLoginDate()
    {
        return loginDate;
    }

    public void setLoginDate(Date loginDate)
    {
        this.loginDate = loginDate;
    }

    public SysDept getDept()
    {
        return dept;
    }

    public void setDept(SysDept dept)
    {
        this.dept = dept;
    }

    public List<SysRole> getRoles()
    {
        return roles;
    }

    public void setRoles(List<SysRole> roles)
    {
        this.roles = roles;
    }

    public Long[] getRoleIds()
    {
        return roleIds;
    }

    public void setRoleIds(Long[] roleIds)
    {
        this.roleIds = roleIds;
    }

    public Long[] getPostIds()
    {
        return postIds;
    }

    public void setPostIds(Long[] postIds)
    {
        this.postIds = postIds;
    }

    public Long getRoleId()
    {
        return roleId;
    }

    public void setRoleId(Long roleId)
    {
        this.roleId = roleId;
    }

    public String getNativePlace() {
        return nativePlace;
    }

    public void setNativePlace(String nativePlace) {
        this.nativePlace = nativePlace;
    }

    public String getHomeAdress() {
        return homeAdress;
    }

    public void setHomeAdress(String homeAdress) {
        this.homeAdress = homeAdress;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getHighestEducation() {
        return highestEducation;
    }

    public void setHighestEducation(String highestEducation) {
        this.highestEducation = highestEducation;
    }

    public String getGraduateSchool() {
        return graduateSchool;
    }

    public void setGraduateSchool(String graduateSchool) {
        this.graduateSchool = graduateSchool;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public String getMajorName() {
        return majorName;
    }

    public void setMajorName(String majorName) {
        this.majorName = majorName;
    }

    public String getAdministrativePost() {
        return administrativePost;
    }

    public void setAdministrativePost(String administrativePost) {
        this.administrativePost = administrativePost;
    }

    public String getWorkTime() {
        return workTime;
    }

    public void setWorkTime(String workTime) {
        this.workTime = workTime;
    }

    public String getEnterUnitTime() {
        return enterUnitTime;
    }

    public void setEnterUnitTime(String enterUnitTime) {
        this.enterUnitTime = enterUnitTime;
    }

    public String getEmploymentMode() {
        return employmentMode;
    }

    public void setEmploymentMode(String employmentMode) {
        this.employmentMode = employmentMode;
    }

    public String getReadyPartyTime() {
        return readyPartyTime;
    }

    public void setReadyPartyTime(String readyPartyTime) {
        this.readyPartyTime = readyPartyTime;
    }

    public String getPartyTime() {
        return partyTime;
    }

    public void setPartyTime(String partyTime) {
        this.partyTime = partyTime;
    }

    public String getOrganizationRelationTime() {
        return organizationRelationTime;
    }

    public void setOrganizationRelationTime(String organizationRelationTime) {
        this.organizationRelationTime = organizationRelationTime;
    }

    public String getPartyType() {
        return partyType;
    }

    public void setPartyType(String partyType) {
        this.partyType = partyType;
    }

    public Long getFlowPartyMemberDept() {
        return flowPartyMemberDept;
    }

    public void setFlowPartyMemberDept(Long flowPartyMemberDept) {
        this.flowPartyMemberDept = flowPartyMemberDept;
    }

    public String getRecordLocation() {
        return recordLocation;
    }

    public void setRecordLocation(String recordLocation) {
        this.recordLocation = recordLocation;
    }

    public String getNation() {
        return nation;
    }

    public void setNation(String nation) {
        this.nation = nation;
    }

    public String getPostName() {
        return postName;
    }

    public void setPostName(String postName) {
        this.postName = postName;
    }

    public String getFlowPartyMemberDeptName() {
        return flowPartyMemberDeptName;
    }

    public void setFlowPartyMemberDeptName(String flowPartyMemberDeptName) {
        this.flowPartyMemberDeptName = flowPartyMemberDeptName;
    }

    public Long getSeq() {
        return seq;
    }

    public void setSeq(Long seq) {
        this.seq = seq;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("userId", getUserId())
            .append("deptId", getDeptId())
            .append("userName", getUserName())
            .append("nickName", getNickName())
            .append("email", getEmail())
            .append("phonenumber", getPhonenumber())
            .append("sex", getSex())
            .append("avatar", getAvatar())
            .append("password", getPassword())
            .append("status", getStatus())
            .append("delFlag", getDelFlag())
            .append("loginIp", getLoginIp())
            .append("loginDate", getLoginDate())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .append("dept", getDept())
            .toString();
    }
}
